
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Creating remote databases</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp77.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp79.htm" >Next</A>
<!-- End Header -->
<A NAME="BCGJBBCH"></A><h1>Creating remote databases</h1>
<A NAME="TI2066"></A><p>Any <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere database
can be converted for use as a remote database in a MobiLink installation.
You can also create a new <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
remote database that uses all or part of the schema of the consolidated <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere database. </p>
<A NAME="TI2067"></A><p>You create the database on your desktop using the Sybase Central <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere plug-in, the Create
ASA Database utility in the Database painter, or another tool. If
your database uses an English character set, use the 1252 Latin1 collation
sequence.</p>
<A NAME="TI2068"></A><p>To use a database as a remote database for MobiLink synchronization,
you need to create at least one publication and MobiLink user, then
add a subscription to the publication for the user. See <A HREF="apptechp78.htm#BCGJCEDD">"Creating and modifying publications"</A>, <A HREF="apptechp78.htm#BCGBADDB">"Creating MobiLink users"</A>, and <A HREF="apptechp78.htm#BCGFJDFF">"Adding subscriptions"</A>.</p>
<A NAME="TI2069"></A><h4>Remote database schemas</h4>
<A NAME="TI2070"></A><p>Tables in a remote database need not be identical to those
in the consolidated database, but you can often simplify your design
by using a table structure in the remote database that is a subset
of the one in the consolidated database. Using this method ensures
that every table in the remote database exists in the consolidated
database. Corresponding tables have the same structure and foreign
key relationships as those in the consolidated database.</p>
<A NAME="TI2071"></A><p>Tables in the consolidated database frequently contain extra
columns that are not synchronized. Extra columns can even aid synchronization.
For example, a timestamp column can identify new or updated rows
in the consolidated database. In other cases, extra columns or tables
in the consolidated database might hold information that is not
required at remote sites.</p>
<A NAME="BCGJCEDD"></A><h2>Creating and modifying publications</h2>
<A NAME="TI2072"></A><p>You create publications using Sybase Central or the <ACRONYM title = "sequel" >SQL</ACRONYM> <b>CREATE PUBLICATION</b> statement.
In Sybase Central, all publications and articles appear in the Publications
folder. This section describes how to create publications in Sybase
Central. For information about creating and modifying publications
using <ACRONYM title = "sequel" >SQL</ACRONYM>, see the online <i>MobiLink
- Client Administration</i>
 book.</p>
<A NAME="BCGIAEJE"></A><h4>Connecting to the database
in Sybase Central</h4>
<A NAME="TI2073"></A><p>You use the <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
plug-in in Sybase Central, not the MobiLink Synchronization plug-in,
to work with MobiLink clients and remote databases. For information
on starting Sybase Central from the PowerBuilder design time environment,
see the <i>Users Guide</i>
.</p>
<A NAME="TI2074"></A><p>You must have DBA authority to create or modify publications,
MobiLink users, and subscriptions.</p>
<A NAME="TI2075"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To connect to the database in Sybase Central: </p>
<ol><li class=fi><p>Start Sybase Central, select Connections&gt;Connect
with <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere 11 from the
Sybase Central menu bar.</p></li>
<li class=ds><p>On the Identification page in the Connect dialog
box, enter DBA as the user name and SQL as the password, select
or browse to the data source name or file and click OK.</p></li></ol>
<br><A NAME="BCGGGEAB"></A><h4>Publishing all the rows and
columns in a table</h4>
<A NAME="TI2076"></A><p>The simplest publication you can create is a single article
that consists of all rows and columns of one or more tables. The
tables must already exist.</p>
<A NAME="TI2077"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To publish one or more entire tables in Sybase
Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the Publications folder and select File&gt;New&gt;Publication
from the Sybase Central menu.</p></li>
<li class=ds><p>Type a name for the new publication and click
Next.</p></li>
<li class=ds><p>On the Specify Tables page, select a table from
the list of available tables and click Add.</p><p>The table appears in the list of selected tables on the right.</p></li>
<li class=ds><p>Optionally, add more tables. The order of the
tables is not important.</p></li>
<li class=ds><p>Click Finish.</p></li></ol>
<br><A NAME="BABJFHEH"></A><h4>Publishing only some columns
in a table</h4>
<A NAME="TI2078"></A><p>You can create a publication that contains all the rows but
only some of the columns of a table. </p>
<A NAME="TI2079"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To publish only some columns in a table in Sybase
Central: </p>
<ol><li class=fi><p>Follow the first four steps of the procedure
in <A HREF="apptechp78.htm#BCGGGEAB">"Publishing all the rows and
columns in a table"</A>.</p></li>
<li class=ds><p>Click Next. On the Specify Columns page, double-click
the table's icon to expand the list of available columns,
select each column you want to publish, and click Add.</p><p>The selected columns appear on the right.</p></li>
<li class=ds><p>Click Finish.</p></li></ol>
<br><A NAME="TI2080"></A><h4>Publishing only some rows in a table</h4>
<A NAME="TI2081"></A><p>You can create a publication that contains some or all of
the columns in a table, but only some of the rows. You do so by
writing a search condition that matches only the rows you want to
publish.In MobiLink, you can use the <b>WHERE</b> clause
to exclude the same set of rows from all subscriptions to a publication.
All subscribers to the publication upload any changes to the rows
that satisfy the search condition.</p>
<A NAME="TI2082"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To create a publication using a WHERE clause in
Sybase Central: </p>
<ol><li class=fi><p>Follow the first four steps of the procedure
in <A HREF="apptechp78.htm#BCGGGEAB">"Publishing all the rows and
columns in a table"</A>,
and optionally the first two steps of the procedure in <A HREF="apptechp78.htm#BABJFHEH">"Publishing only some columns
in a table"</A>.</p></li>
<li class=ds><p>Click Next. On the Specify Where Clauses page,
select the table and type the search condition in the lower box. </p><p>Optionally, you can use the Insert dialog box to help you
format the search condition.</p></li>
<li class=ds><p>Click Finish.</p></li></ol>
<br><A NAME="TI2083"></A><h4>Adding articles</h4>
<A NAME="TI2084"></A><p>You can add articles to existing publications.</p>
<A NAME="TI2085"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To add articles in Sybase Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the Publications folder and double-click
the name of the publication to which you want to add an article.</p></li>
<li class=ds><p>Select File&gt;New&gt;Article from
the Sybase Central menu.</p></li>
<li class=ds><p>In the Create Article wizard, select a table and
click Next.</p></li>
<li class=ds><p>If you want only some columns to be synchronized,
select the Selected Columns radio button and select the columns.</p></li>
<li class=ds><p>If you want to add a <b>WHERE</b> clause,
click Next and enter the clause.</p></li>
<li class=ds><p>Click Finish.</p></li></ol>
<br><A NAME="TI2086"></A><h4>Modifying and removing publications and articles</h4>
<A NAME="TI2087"></A><p>You can modify or drop existing publications in Sybase Central
by navigating to the location of the publication and selecting Properties
or Delete from its pop-up menu. You can modify and remove articles
in the same way.</p>
<A NAME="TI2088"></A><p>Publications can be modified only by the DBA or the publication's
owner. You must have DBA authority to drop a publication. If you
drop a publication, all subscriptions to that publication are automatically
deleted as well.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Avoid altering publications in a running MobiLink setup</span> <A NAME="TI2089"></A>Altering publications in a running MobiLink setup is likely
to cause replication errors and can lead to loss of data unless
carried out with care.</p>
<A NAME="BCGBADDB"></A><h2>Creating MobiLink users</h2>
<A NAME="TI2090"></A><p>MobiLink users are not the same as database users. Each type
of user resides in a different namespace. MobiLink user IDs can
match the names of database users, but there is no requirement that
they match.</p>
<A NAME="TI2091"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To add a MobiLink user to a remote database in
Sybase Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the MobiLink Users folder and select File&gt;New&gt;User
from the Sybase Central menu.</p></li>
<li class=ds><p>Enter a name for the MobiLink user. </p><p>The name is supplied to the MobiLink synchronization server
during synchronization. In production databases, each user name
is usually added to the consolidated database, then provided to
the individual user.</p></li>
<li class=ds><p>Click Finish.</p></li></ol>
<br><A NAME="TI2092"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To configure MobiLink user properties in Sybase
Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the MobiLink Users folder, right-click the
MobiLink user, and select</p><p>Properties from the pop-up menu.</p></li>
<li class=ds><p>Change the properties as needed.</p></li></ol>
<br><A NAME="TI2093"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To drop a MobiLink user in Sybase Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the MobiLink Users folder, right-click the
MobiLink user, and select</p><p>Delete from the pop-up menu.</p></li></ol>
<br><p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Dropping MobiLink users</span> <A NAME="TI2094"></A>You must drop all subscriptions for a MobiLink user before
you drop the user from a remote database.</p>
<A NAME="BCGFAIDB"></A><h4>Adding MobiLink users
to the consolidated database</h4>
<A NAME="TI2095"></A><p>The consolidated database contains a table called <b>ml_user</b> that
is used to authenticate the names of MobiLink users when a synchronization
is requested. When you add a user to a remote database, you need
to be sure that the user is also added to the <b>ml_user</b> table. </p>
<A NAME="TI2096"></A><p>You can add users automatically by selecting the Automatic
Addition of Users check box in the MobiLink Synchronization Server
Options dialog box and then starting the server. You open this dialog
box from the Utilities folder in the Database painter or Database
Profiles dialog box. You can also start the server from a command
prompt, passing it the <b>-zu+</b> switch.</p>
<A NAME="TI2097"></A><p>Any users defined in the remote database are added to the <b>ml_user</b> table
in the consolidated database, as long as the script for the <b>authenticate_user</b> connection
event is undefined. Typically the <b>-zu+</b> switch
is not used in a production environment. Names are usually added
to the <b>ml_user</b> table in the consolidated
database, then added to each of the remote databases. Each user is
given a unique name and optional password.</p>
<A NAME="BCGFJDFF"></A><h2>Adding subscriptions</h2>
<A NAME="TI2098"></A><p>A synchronization subscription links a particular MobiLink
user with a publication. You must have at least one publication
and one user to create a subscription. </p>
<A NAME="TI2099"></A><p>A subscription can also carry other information needed for
synchronization. For example, you can specify the address of the
MobiLink server and other connection options. Values for a specific
subscription override those set for individual MobiLink users.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Overriding options in the wizard</span> <A NAME="TI2100"></A>You can override the MobiLink server name and port set for
the subscription and user with settings in the ASA MobiLink Synchronization
wizard in PowerBuilder.</p>
<A NAME="TI2101"></A><p>Synchronization subscriptions are required in MobiLink <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere remote databases. Server
logic is implemented through synchronization scripts, stored in
the MobiLink system tables in the consolidated database.</p>
<A NAME="TI2102"></A><p>A
single <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere database
can synchronize with more than one MobiLink synchronization server.
To allow synchronization with multiple servers, create different
subscriptions for each server.</p>
<A NAME="TI2103"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To add a subscription for a MobiLink user in Sybase
Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the Publications folder, select the publication
for which you want to enter a subscription, select the Synchronization
Subscriptions tab in the right pane of Sybase Central, then select
File&gt;New&gt;Synchronization Subscription from the
menu bar.</p><p>Instead of creating a new subscription in the Publications
folder, you can create one in the MobiLink Users folder by double-clicking
the user for whom you want to create a subscription, and then selecting File&gt;New&gt;Synchronization
Subscription from the menu bar.</p></li>
<li class=ds><p>In the Create Synchronization Subscription wizard,
select the user for whom you want to enter a subscription and click
Finish.</p><p>If you started the wizard from the MobiLink Users folder,
the wizard prompts you to select the publication to which you want
to subscribe. In this case, select the publication and click Finish.</p></li></ol>
<br><A NAME="TI2104"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To modify a subscription in Sybase Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the MobiLink Users folder and double-click
the name of the MobiLink user who owns the subscription you want
to modify.</p></li>
<li class=ds><p>On the Synchronization Subscriptions tab, right-click
the subscription you want to modify and select Properties from the
pop-up menu.</p></li>
<li class=ds><p>Change the properties as needed on the Connection
and Extended Options pages of the Synchronization Subscription Properties
dialog box.</p></li></ol>
<br><A NAME="TI2105"></A><p><img src="images/proc.gif" width=17 height=17 border=0 align="bottom" alt="Steps"> To delete a synchronization subscription in Sybase
Central: </p>
<ol><li class=fi><p>Connect to Sybase Central as described
in <A HREF="apptechp78.htm#BCGIAEJE">"Connecting to the database
in Sybase Central"</A>.</p></li>
<li class=ds><p>Open the MobiLink Users folder and double-click
the name of the MobiLink user who owns the subscription you want
to delete.</p></li>
<li class=ds><p>On the Synchronization Subscriptions tab, right-click
the subscription you want to delete and click Delete.</p></li>
<li class=ds><p>Click Yes in the Confirm Delete dialog box.</p></li></ol>
<br>
